package org.elasticsearch;

import com.obs.services.internal.security.BasicSecurityKey;
import org.elasticsearch.common.settings.Settings;

import java.util.Map;


public class ObsClientSettingTest {

    @org.junit.jupiter.api.Test
    public void testCredentialsTypeWithAccessKeyAndSecretKeyAndSessionToken() {
        final MockSecureSettings secureSettings = new MockSecureSettings();
        secureSettings.setString("access_key", "access_key");
        secureSettings.setString("secret_key", "secret_key");
        secureSettings.setString("session_token", "session_token");
        final Map<String, ObsClientSettings> settings = ObsClientSettings.load(Settings.builder().setSecureSettings(secureSettings).build());
        final ObsClientSettings defaultSettings = settings.get("default");
        BasicSecurityKey credentials =  defaultSettings.basicSecurityKey;
        assert  (credentials.getAccessKey()=="access_key");
        assert(credentials.getSecretKey()=="secret_key");
        assert(credentials.getSecurityToken()=="session_token");
    }

}
